package com.mjk.manager.api.constns;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;


/**
 * 接口返回数据类型
 * @author msi
 *
 */
@Getter
public enum ApiRequestType {
	XMLDATA("3","ResponseType.CUSTM"),
	JSONDATA("2","ResponseType.XML"),
	NORMAL("1","ResponseType.JSON");	
	private final String type;
	private final String remark;
	ApiRequestType(String type,String remark){
		this.remark = remark;
		this.type = type;
	}

	public static Map<String, String> toMap() {
		ApiRequestType[] ary = values();
		Map<String, String> enumMap = new HashMap<>();
        for (ApiRequestType apiRequestType : ary) {
            enumMap.put(apiRequestType.getType(), apiRequestType.getRemark());
        }
		return enumMap;
	}
	
	public static String getType(String code){
		ApiRequestType[] ary = values();
		String remark = "";
        for (ApiRequestType apiRequestType : ary) {
            if (apiRequestType.getType().equals(code)) {
                remark = apiRequestType.getRemark();
                break;
            }
        }
		return remark;
	}
}
